/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package consys.social.core.service;

import consys.social.core.NotAuthorizedException;
import consys.social.core.bo.Entity;
import java.io.IOException;
import java.util.List;

/**
 *
 * @author petan
 */
//TODO: maybe loading full entity in one method could be efficient in certain situations
public interface FollowService {

    /**
     * Returns all followers of entity
     * Entity has to contain only uid. Nothing else needed -
     * other properties are ignored.
     *
     * @param entity (uid only)
     * @return list of entity followers uids
     */
    List<String> getAllFollowersUid(Entity entity) throws IOException;

    /**
     * Returns all uids which entity follows
     * Entity has to contain only uid. Nothing else needed -
     * other properties are ignored.
     *
     * @param entity (uid only)
     * @return list of entity followers uids
     */
    List<String> getAllFollowingsUid(Entity entity) throws IOException;

    /**
     * Returns random followers of entity
     * Entity has to contain only uid. Nothing else needed -
     * other properties are ignored.
     *
     * @param entity (uid only)
     * @param count how many followers to return
     * @return List of entities following our entity - entity contains only uid, other data has to be loaded separately as needed
     * or use other method
     */
    List<Entity> getRandomFollowers(Entity entity, int count) throws IOException;

    /**
     * Returns random entities which entity follows
     * Entity has to contain only uid. Nothing else needed -
     * other properties are ignored.
     *
     * @param entity (uid only)
     * @param count how many followings to return
     * @return List of entities our entity follows - entity contains only uid, other data has to be loaded separately as needed
     * or use other method
     */
    List<Entity> getRandomFollowings(Entity entity, int count) throws IOException;

    List<Entity> getFollowings(Entity entity, int from, int howMany) throws IOException;

    List<Entity> getFollowers(Entity entity, int from, int howMany) throws IOException;

    void follow(Entity who, Entity whom) throws IOException, NotAuthorizedException;
    void unfollow(Entity who, Entity whom) throws IOException, NotAuthorizedException;
    void block(Entity who, Entity whom) throws IOException, NotAuthorizedException;
    boolean isFollowing(Entity who, Entity whom) throws IOException;
}
